/*
* 判断一颗二叉树是否为轴对称的，递归做法
* https://leetcode.cn/problems/symmetric-tree/
* */
class IsSymmetricDiGui {
    public boolean isSymmetric(TreeNode root) {
        if(root==null){
            return false;
        }
        return isSymmetricChild(root.left,root.right);
       
    }
     public boolean isSymmetricChild(TreeNode leftTree,TreeNode rightTree){
            if(leftTree==null&&rightTree!=null)
            return false;
            if(leftTree!=null&&rightTree==null){
                return false;
            }
            if(leftTree==null&&rightTree==null){
                return true;
            }
            if(leftTree.val!=rightTree.val)
            return false;
            return isSymmetricChild(leftTree.left,rightTree.right)&&isSymmetricChild(leftTree.right,rightTree.left);
        }
}